package com.mayi.base;

import java.util.Arrays;
import java.util.Scanner;

public class ZhaoRouZiMaoPao {

    //降序
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        System.out.println("请输入要排序数字的个数");
        int n = s.nextInt();
        int[] arr = new int[n];
        System.out.println("请输入要排序的数字");
        for (int i = 0; i < arr.length; i++) {
            arr[i] = s.nextInt();
        }
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - 1 - i; j++) {
                if (arr[j] < arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}

